<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>广告费充值</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css"/>
		<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
		<link rel="stylesheet" href="__INDEX__/css/mall.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class=" mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">广告费充值</h1>
		</header>
		<div class="mui-content recharge_content">
			<div class="recharge_top">
				<ul class="recharge_lis clearfix">
					<li style="width: 100%;">
						<p class="style">广告费余额</p>
						<p class="num">{$agent_info['ad_money']}</p>
					</li>
				</ul>
			</div>
		    <div class="exchange_lisbox">
		    	<ul class="mui-table-view mui-grid-view mui-grid-9 eul clearfix">
		    		<li>
		    			<div data-value="10" class=" eli">
		    				<p>10元</p>
		    				<p class="sxjif">10广告费</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="30" class=" eli">
		    				<p>30元</p>
		    				<p class="sxjif">30广告费</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="50" class=" eli">
		    				<p>50元</p>
		    				<p class="sxjif">50广告费</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="100" class=" eli">
		    				<p>100元</p>
		    				<p class="sxjif">100广告费</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="300" class=" eli">
		    				<p>300元</p>
		    				<p class="sxjif">300广告费</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="500" class=" eli">
		    				<p>500元</p>
		    				<p class="sxjif">500广告费</p>
		    			</div>
		    		</li>
		    	</ul>
		    </div>
		    <button class="wallet_btn" id='quren' style="width: 100%; background-color: #FF5722; color: #FFFFFF; height: 40px;">确认</button>
		    <div class="exchange_tip">
		    	<div class="exchange_bt"><span>温馨提示</span></div>
		    	<p>100元可充值1000广告费，1元人民币=10广告费，100元起充。</p>
		    </div>
		</div>
		<form method="post" id='myform'>
			<input type="hidden" name="pay_money" id="pay_money" />
			<input type="hidden" name="charge_type" id="charge_type" value="2"/>
		</form>
	</body>
</html>
{include file="public/footer" /}
<script type="text/javascript" src="__PUBLIC__/static/js/assist.js"></script>
<script>
	
	$('#quren').click(function(){
		//付款金额
		var pay_money = $("#pay_money").val();
		$("#quren").attr("disabled", true);
		if(pay_money && pay_money<10){
			layer.msg('请选择充值金额');
			$("#quren").attr("disabled", false);
			return ;
		}
		
		$.ajax({
         	type:"post",
            url:"{:url('index/pay/score_pay')}",
            data: $('#myform').serialize(),//表单数据
            success:function(data){
            	if(data.code == 200){
            		location.href = data.url;
            	}else{
            		layer.msg(data.msg);
            	}
                
            },error:function(data){
            	var a = data;
            }
    	});
		
	})
	
		
	//获取选中的充值金额
	$(".eli").click(function(){
		$(".eul").find(".active").removeClass("active");
		$(this).addClass("active");
		$("#pay_money").val($(this).data("value"));
	})
	
	//只能数字和小数点
	function clearNoNum(obj) {
		obj.value = obj.value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
		obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字而不是.
		obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的.
		obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
	}
</script>